package com.gdevelop.examples.demo.client;

import java.util.Arrays;

import org.eclipse.core.databinding.observable.list.WritableList;

public class ListBindingController extends BaseController{
  /** List Box */
  private int dropBoxSelectedIndex;
  public int getDropBoxSelectedIndex(){
    return dropBoxSelectedIndex;
  }
  public void setDropBoxSelectedIndex(int dropBoxSelectedIndex){
    this.dropBoxSelectedIndex = dropBoxSelectedIndex;
  }
  
  private WritableList<String> multiBoxData = new WritableList<String>();
  
  public ListBindingController() {
    dropBoxSelectedIndex = 0;
    showCategory();
  }
  
  public WritableList<String> getMultiBoxData(){
    return multiBoxData;
  }
  
  public void showCategory(){
    multiBoxData.clear();
    switch (dropBoxSelectedIndex) {
    case 0:
      multiBoxData.addAll(Arrays.asList(Demo.constants.cwListBoxCars()));
      break;
    case 1:
      multiBoxData.addAll(Arrays.asList(Demo.constants.cwListBoxSports()));
      break;
    case 2:
      multiBoxData.addAll(Arrays.asList(Demo.constants.cwListBoxVacations()));
      break;
    }
  }

  /**
   * @return the User list
   */
  public UserList getUserList(){
    return Demo.users;
  }
}
